package codetop.microsoft.T78;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 18362
 * @Create: 2022-08-16 23:19:03 星期二
 */
class Solution {
    private List<List<Integer>> results = new ArrayList<>();
    public List<List<Integer>> subsets(int[] nums) {
        dfs(nums, 0, new ArrayList<>());
        return results;
    }

    private void dfs(int[] nums, int cur, List<Integer> res) {
        if (cur == nums.length) {
            results.add(new ArrayList<>(res));
            return;
        }
        res.add(nums[cur]);
        dfs(nums, cur+1, res);
        res.remove(res.size()-1);
        dfs(nums, cur+1, res);
    }
}